#include "Avalon/Serialization/ShuttleUuid.hpp"
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>

using namespace Avalon;
using namespace Avalon::Serialization;
using namespace boost;
using namespace boost::uuids;
using namespace std;

template<>
void Avalon::Serialization::Shuttle(DataShuttle* shuttle, uuid& value,
    unsigned int version) {
  if(shuttle->IsReceiving()) {
    string uid;
    shuttle->Shuttle("uuid", uid);
    string_generator stringGenerator;
    value = stringGenerator(uid);
  } else {
    stringstream sink;
    sink << value;
    string uid = sink.str();
    shuttle->Shuttle("uuid", uid);
  }
}
